home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
pdox693.zip
/
TI1243.ASC
< prev
next >
Wrap
Text File
|
1993-01-29
|
9KB
|
265 lines
PRODUCT : Paradox NUMBER : 1243
VERSION : All
OS : DOS
DATE : January 29, 1993 PAGE : 1/4
TITLE : Performing Copy and Paste Functions of Calculated
Field Expressions By Using the PAL SETKEY Command
Intended Audience:
This Technical Information sheet is intended for someone with a
moderate level of Paradox experience and an aptitude for using
PAL.
Prerequisites:
A basic understanding of the Paradox Report Generator and
experience in creating calculated fields.
Purpose:
This Technical Information sheet illustrates how the PAL SETKEY
command can be used to create keyboard macros that perform copy
and paste functions of Calculated Field expressions. The
keyboard macros presented in this Technical Information sheet are
intended for use on Calculated Fields only. They do not function
on Summary Calculated Fields.
It is sometimes desirable to copy a calculated field expression
in either a form or report to another calculated field. One
possible way to accomplish this operation is to use the PAL
SETKEY command to create keyboard macros which will perform copy
and paste functions. The SETKEY command attaches a sequence of
one or more commands to the key you specify. These keys must be
specified as a valid PAL keycode expression as defined in
Appendix G in the PAL Reference Guide (for versions earlier than
4.0, refer to Appendix B in the PAL User's Guide). When the key
(or key combination) is pressed, the commands are executed. A
sequence of commands that are defined in this way are called
"keyboard macros". For additional information on keyboard
macros, refer to Chapter 20 of the PAL Programmer's Guide (for
versions earlier than 4.0, refer to the Chapter 16 of the PAL
User's Guide).
The PAL script on the following page sets up two keyboard macros;
one that copies a calculated field expression (of a form or
report) to a variable called copyvar and one that pastes the
variable copyvar into a new calculated field (of a form or
report).
NOTE: The keyboard macros in this Technical Information sheet are
intended for use on Calculated Fields only. They do not function
on Summary Calculated Fields.
PRODUCT : Paradox NUMBER : 1243
VERSION : All
OS : DOS
DATE : January 29, 1993 PAGE : 2/4
TITLE : Performing Copy and Paste Functions of Calculated
Field Expressions By Using the PAL SETKEY Command
To create a PAL script:
1. From the Paradox Main Menu, select:
- Scripts
- Editor
- New (Write for versions earlier than 4.0)
2. At the prompt, type "Calc-cpy" as the name of the script
3. Type in the following PAL code:
SETKEY 3 If SYSMODE()="Form" or SYSMODE()="Report" Then
Menu {Field} {CalcEdit} Enter copyvar=MENUCHOICE() Menu
Esc Endif
SETKEY 16 If SYSMODE()="Form" or SYSMODE()="Report" and
ISBLANK(copyvar) = False Then Menu {Field} {Place}
{Calculated} TYPEIN copyvar Endif
Each SETKEY statement above is split onto more than one
line because of formatting. Note: In your PAL script each
SETKEY statement must be typed on a single line (it can't
continue onto multiple lines). If your entire macro won't
fit on a single line, place the commands in a script and
let the macro consist of a single PLAY command.
When you are finished typing in the above PAL code, press <F2> to
save the script.
The first keyboard macro in the script assigns the PAL code to
<Ctrl-C> (where 3 is the extended code for <Ctrl-C>). When
<Ctrl-C> is pressed, the setkey macro does the following:
1. Checks to see if Paradox is in Form or Report mode.
2. If Paradox is in Form or Report mode, the keyboard macro
copies the calculated field expression to the variable
copyvar. If Paradox is not in Form or Report mode, the
keyboard macro will not do anything.
PRODUCT : Paradox NUMBER : 1243
VERSION : All
OS : DOS
DATE : January 29, 1993 PAGE : 3/4
TITLE : Performing Copy and Paste Functions of Calculated
Field Expressions By Using the PAL SETKEY Command
NOTE: In order to copy a calculated field expression with
<Ctrl-C>, it is first necessary to position the cursor on
a calculated field. If the cursor is not positioned on a
calculated field and you press <Ctrl-C>, the variable
copyvar will be a blank string. <Ctrl-C> is just one
possible keycode that you could use for the first setkey
macro. See Appendix G of the PAL Reference Guide for a
list of Keycodes Recognized by Paradox (for versions
earlier than 4.0, refer to Appendix B of the PAL User's
Guide).
The second keyboard macro in the script assigns the PAL code to
<Ctrl-P> (where 16 is the extended code for <Ctrl-P>). When
<Ctrl-P> is pressed, the setkey macro does the following:
1. Checks to see if Paradox is in Form or Report mode.
2. If Paradox is in Form or Report mode, it creates a
calculated field and types in the value of the variable
copyvar as the calculated expression. If the variable
copyvar is a blank string (this would happen if you
pressed <Ctrl-C> on a regular field instead of a
calculated field), the second keyboard macro will not do
anything.
3. At this point, you may add to or modify the current
expression. When you are finished, press <Enter>. Once
you have accepted the expression, you will need to adjust
the field size. If you are in a report and your
expression contains PAL functions, you will need to
reformat the field mask to the appropriate number of
characters.
4. If Paradox is not in Form or Report mode, the keyboard
macro will not do anything.
NOTE: In order to paste the copied calculated field
expression, it is first necessary to be in Form or Report
mode and to position the cursor at the location where you
want the calculated field.
PRODUCT : Paradox NUMBER : 1243
VERSION : All
OS : DOS
DATE : January 29, 1993 PAGE : 4/4
TITLE : Performing Copy and Paste Functions of Calculated
Field Expressions By Using the PAL SETKEY Command
To play the script:
1. From the Paradox Main Menu, select Scripts | Play
2. Type "Calc-cpy" as the name of the script
NOTE: When you play the script "Calc-cpy", Paradox reads the
SETKEY statements into memory for that Paradox session or until
the key is redefined. When you exit out of Paradox, the SETKEYs
are disabled and the next time you start up Paradox, they remain
inactive until you play the "Calc-cpy" script.
To enable SETKEYs every time you start Paradox, you can define
the SETKEYs in a script called "Init" (located in the same
directory as your Paradox program files or the private directory
if you are using Paradox on a network). The Init script is a
Paradox program that runs automatically when Paradox is started
(like an Autoexec.bat file runs automatically when a computer is
booted). For additional information about Init scripts, refer to
Chapter 7 of the PAL Programmer's Guide (for versions earlier
than 4.0, refer to Chapter 7 of the PAL User's Guide).
For additional information on PAL, refer to the PAL Reference
Guide (for Paradox versions earlier than 4.0, refer to the PAL
User's Guide).
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.